<template>
  <div class="my">
    <!-- 个人信息 -->
    <div class="header">
      <div class="topHeader">
        <div class="left">
          <div class="userName">{{ userInfo.nickname }}</div>
          <div class="quotes">{{ userInfo.intro }}</div>
        </div>
        <div class="right" @click="$router.push('/Home/EdiUser')">
          <img :src="baseURL + userInfo.avatar" alt="" />
        </div>
      </div>
      <div class="bottomHeader">
        <span>
          <div class="num">{{ userInfo.submitNum }}</div>
          <div class="quotes">累计答题</div>
        </span>
        <span>
          <div class="num">{{ userInfo.collectQuestions.length }}</div>
          <div class="quotes">收藏题目</div>
        </span>
        <span>
          <div class="num">{{ userInfo.errorNum }}</div>
          <div class="quotes">我的错题</div>
        </span>
        <span>
          <div class="num">
            <!-- 四舍五入计算正确率 -->
            {{
              Math.round(
                ((userInfo.submitNum - userInfo.errorNum) /
                  userInfo.submitNum) *
                  100
              )
            }}<i>%</i>
          </div>
          <div class="quotes">正确率</div>
        </span>
      </div>
    </div>
    <div class="center">
      <!-- 我的岗位 -->
      <div class="topCenter">
        <van-cell
          title="我的岗位"
          :value="userInfo.position"
          is-link
          arrow-direction
          class="title"
        >
          <template #icon>
            <i class="iconfont">&#xe64d;</i>
          </template>
        </van-cell>
      </div>
      <!-- 面经数据 -->
      <div class="middleCenter">
        <div class="middleTitle">面经数据</div>
        <div class="middleFooter">
          <span>
            <div class="middleTop">
              昨日阅读 <i>+{{ userInfo.shareData.read.yesterday }}</i>
            </div>
            <div class="middleCenter">{{ userInfo.shareData.read.total }}</div>
            <div class="middleBottom">阅读总数</div>
          </span>
          <span>
            <div class="middleTop">
              昨日获赞 <i>+{{ userInfo.shareData.star.yesterday }}</i>
            </div>
            <div class="middleCenter">
              {{ userInfo.shareData.star.total }}
            </div>
            <div class="middleBottom">获赞总数</div>
          </span>
          <span>
            <div class="middleTop">
              昨日新增 <i>+{{ userInfo.shareData.comment.yesterday }}</i>
            </div>
            <div class="middleCenter">
              {{ userInfo.shareData.comment.total }}
            </div>
            <div class="middleBottom">评论总数</div>
          </span>
        </div>
      </div>
      <!-- 面经分享 -->
      <div class="bottomCenter topCenter">
        <van-cell
          title="我的面经分享"
          value="21"
          is-link
          arrow-direction
          class="title"
        >
          <template #icon>
            <i class="iconfont">&#xe655;</i>
          </template>
        </van-cell>
        <van-cell
          title="我的消息"
          value="98"
          is-link
          arrow-direction
          class="title"
        >
          <template #icon>
            <i class="iconfont">&#xe656;</i>
          </template>
        </van-cell>
        <van-cell
          title="收藏的题库"
          value="32"
          is-link
          arrow-direction
          class="title"
        >
          <template #icon>
            <i class="iconfont">&#xe654;</i>
          </template>
        </van-cell>
        <van-cell
          title="收藏的企业"
          value="32"
          is-link
          arrow-direction
          class="title"
        >
          <template #icon>
            <i class="iconfont">&#xe648;</i>
          </template>
        </van-cell>
        <van-cell
          title="我的错题"
          value="123"
          is-link
          arrow-direction
          class="title"
        >
          <template #icon>
            <i class="iconfont">&#xe64f; </i>
          </template>
        </van-cell>
        <van-cell
          title="收藏的面试经验"
          value="106"
          is-link
          arrow-direction
          class="title"
        >
          <template #icon>
            <i class="iconfont">&#xe649;</i>
          </template>
        </van-cell>
      </div>
    </div>
  </div>
</template>
<script>
import { mapState } from 'vuex'
export default {
  computed: { ...mapState(['userInfo']) },
  data () {
    return {
      baseURL: process.env.VUE_APP_BASEURL
    }
  },
  methods: {}
}
</script>
<style lang="less" scoped>
.my {
  height: 100%vh;
  background: #f7f4f5;
  .header {
    height: 260px;
    opacity: 1;
    background: linear-gradient(45deg, #ce0031, #b8002c);
    padding: 75px 15px 0;
    .topHeader {
      display: flex;
      justify-content: space-between;
      .left {
        .userName {
          font-size: 21px;
          color: #ffffff;
          opacity: 1;
        }
      }
      .right {
        img {
          width: 50px;
          height: 50px;
          opacity: 1;
          border: 3px solid rgba(255, 255, 255, 0.38);
          border-radius: 50%;
          margin-right: 22px;
        }
      }
    }
    .quotes {
      color: #ffffff;
      opacity: 0.7;
      font-size: 12px;
      margin-top: 10px;
    }
    .bottomHeader {
      margin-top: 31px;
      margin-right: 16px;
      display: flex;
      justify-content: space-between;
      text-align: center;
      .num {
        opacity: 1;
        font-size: 21px;
        color: #ffffff;
        i {
          font-size: 2px;
          //   transform: scale(0.2);
        }
      }
    }
  }
  .center {
    padding: 0 15px;
    .topCenter {
      margin-top: -30px;
      /deep/ .van-cell {
        padding-top: 15px;
        font-size: 14px;
        color: #181a39;
      }
      /deep/ .van-cell::after {
        border: 0;
      }
      .title {
        width: 345px;
        height: 55px;
        opacity: 1;
        background: #ffffff;
        border-radius: 8px;
      }
      i {
        margin-right: 12px;
      }
    }
    .middleCenter {
      height: 143px;
      opacity: 1;
      background: #ffffff;
      border-radius: 8px;
      margin-top: 11px;
      padding-top: 19px;
      .middleTitle {
        opacity: 1;
        font-size: 14px;
        font-weight: 600;
        color: #181a39;
        margin: 0 0 0 15px;
      }
      .middleFooter {
        display: flex;
        justify-content: space-between;
        text-align: center;
        padding: 0 25px;
        span {
          .middleTop {
            font-size: 10px;
            color: #b4b4bd;
            // 解除谷歌浏览器禁止字体小于12px默认限制
            transform: scale(0.8);
            margin-top: 18px;
            i {
              color: @color;
              font-style: normal;
            }
          }
          .middleCenter {
            font-size: 21px;
            color: #181a39;
            padding: 0;
            height: 25px;
            margin-bottom: 5px;
          }
          .middleBottom {
            opacity: 1;
            font-size: 12px;
            font-weight: 400;
            color: #545671;
          }
        }
      }
    }
    .bottomCenter {
      margin-top: 10px;
      padding-bottom: 60px;
    }
  }
}
</style>
